﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Net;

using EHTWebsite.Code;
using EHTWebsiteProject.Code.BLL;
using System.Resources;
using System.Threading;
using System.Globalization;
using System.Text;
using Telerik.Web.UI;
using System.Web.Profile;

namespace EHTWebsiteProject.Administrator
{
    public partial class AdminCustomerDetails : System.Web.UI.Page
    {
        public Boolean IsVN = true;
        private String languageCode = "vi-VN";
        private ResourceManager rm = new ResourceManager("Resources.SiteMap", System.Reflection.Assembly.Load("App_GlobalResources"));
        private String Username = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    languageCode = Session[HangSo.LANGUAGE_CODE].ToString();
                    if (languageCode == "en-us")
                    {
                        IsVN = false;
                    }

                }
                catch (Exception ex)
                {
                }

                try
                {
                    Username = Request.QueryString["User"].ToString();
                }
                catch
                { 
                    
                }
                Thread.CurrentThread.CurrentCulture = new CultureInfo(languageCode);
                LoadLanguage(Thread.CurrentThread.CurrentCulture);
               if(Username !=null)
                   LoadDataUsers(Username);

            }
        }


        /// <summary>
        /// Ham load ngon ngu
        /// </summary>
        /// <param name="ci"></param>
        public void LoadLanguage(CultureInfo ci)
        {
            lbHelp.Text = rm.GetString("lbHelp", ci);
            lbCancel.Text = rm.GetString("lbCancel", ci);           
        }

        private void LoadDataUsers(String UserName)
        {
            MembershipUser theUser = Membership.GetUser(Username);
            ProfileBase theProfile = ProfileBase.Create(theUser.UserName);

            lbFirstName.Text = theProfile.GetPropertyValue("FirstName").ToString();
            lbLastName.Text = theProfile.GetPropertyValue("LastName").ToString();
            lbAge.Text = theProfile.GetPropertyValue("Age").ToString();
            lbPhone.Text = theProfile.GetPropertyValue("Phone").ToString();
            lbFax.Text = theProfile.GetPropertyValue("Fax").ToString();
            lbAddress.Text = theProfile.GetPropertyValue("Address").ToString();
            lbCity.Text = theProfile.GetPropertyValue("City").ToString();
            lbEmail.Text = theProfile.GetPropertyValue("Email").ToString();           
        }
    }
}